
//Menu
$(document).ready(function(){
//    $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
    $('.subnav').width($('.subnav').width());
    //$('ul.topnav li').click(
    $('ul.topnav li').hover(
        function () {
            $('.menu-first', this).addClass('slide-down');
            $('.subnav', this).slideDown(0);
        }
    ).hover(
        function () {
            $('.menu-first', this).addClass('slide-down');
        },
        function () {
            obj = this;
            $('.subnav', this).slideUp(0, function(){ $('.menu-first', obj).removeClass('slide-down'); });
        }
    );
});

//Esconder div
function o(whichLayer){
    var elem, vis;
    if( document.getElementById ) // this is the way the standards work
      elem = document.getElementById( whichLayer );
    else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
    else if( document.layers ) // this is the way nn4 works
      elem = document.layers[whichLayer];
      vis = elem.style;
    // if the style.display value is blank we try to figure it out here
    if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
      vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
        vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function printFormat(){
    $( "body" ).css({"width": "100%", "background-color": "#fff"});
    $( "table.maintable" ).css( "width", "100%" );
    $( "td.mainhead" ).css( "font-size", "large" );
    $( "td.maincontent" ).css( "width", "100%" );
    $( "h3" ).css( "font-size", "large" );
    $( "table.tablesorter" ).css({"width": "100%", "font-size": "smaller"});
    $( "table td" ).css({"white-space": "nowrap"});
    $( "table.tablesorter thead tr th" ).css({"font-size": "smaller", "color": "#000", "background-color": "#fff"});
    $( "th.acciones" ).remove();
    $( "td.right" ).remove();
}

//Ordenar tablas
$(document).ready(function() {
	$("#sorter_cotizaciones").tablesorter();
    $("#sorter_clientes").tablesorter();
}); 

//Calendario
$(function() {
    Date.firstDayOfWeek = 7;
    Date.format = 'dd/mm/yyyy';
    $('.date-pick').datePicker({startDate:'01/01/2000'});
});
/*$(document).ready(function() {
    $('.date-pick').datepicker({ dateFormat: dd/mm/yy" });
});*/

//Actualizar valores
$(document).ready(function() {
	$("#id_numeroLinea").change(function(){
		var remito = $("#id_numeroRemito").val();
		var linea = $("#id_numeroLinea").val();
		$("#id_datos").load('/remates/listado/items/ariculo/' + remito + '/' + linea + '/');
	});
});

//Facebox
/*jQuery(document).ready(function($) {
  $('a[rel*=facebox]').facebox();
});*/
